# flask服务
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
CORS(app, resources={r"/": {"origins": "*"}})

# 数据库服务
import pymysql.cursors
connection = pymysql.connect(host='mysql.sqlpub.com',
                             user='os_cloud',
                             password='a4pF5pP9WrXzK6xE',
                             db='eatwhat',
                             charset='utf8mb4',
                             cursorclass=pymysql.cursors.DictCursor)

def getconnection():
    connection.ping(reconnect=True)
    return connection



